﻿<!DOCTYPE html>
<html lang="zh-CN" class="">
 <head> 
  <meta charset="utf-8" /> 
  <meta name="apple-itunes-app" content="app-id=432274380" /> 
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" /> 
  <meta name="renderer" content="webkit" /> 
  <meta name="description" content="一个真实的网络问答社区，帮助你寻找答案，分享知识。" /> 
  <meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=1.0, maximum-scale=1.0" /> 
  <title>知乎 - 与世界分享你的知识、经验和见解</title> 
  <link rel="apple-touch-icon" href="http://static.zhihu.com/static/revved/img/ios/touch-icon-152.87c020b9.png" sizes="152x152" /> 
  <link rel="apple-touch-icon" href="http://static.zhihu.com/static/revved/img/ios/touch-icon-120.496c913b.png" sizes="120x120" /> 
  <link rel="apple-touch-icon" href="http://static.zhihu.com/static/revved/img/ios/touch-icon-76.dcf79352.png" sizes="76x76" /> 
  <link rel="apple-touch-icon" href="http://static.zhihu.com/static/revved/img/ios/touch-icon-60.9911cffb.png" sizes="60x60" /> 
  <link rel="shortcut icon" href="http://static.zhihu.com/static/favicon.ico" type="image/x-icon" /> 
  <link rel="dns-prefetch" href="p1.zhimg.com" /> 
  <link rel="dns-prefetch" href="p2.zhimg.com" /> 
  <link rel="dns-prefetch" href="p3.zhimg.com" /> 
  <link rel="dns-prefetch" href="p4.zhimg.com" /> 
  <link rel="dns-prefetch" href="comet.zhihu.com" /> 
  <link rel="dns-prefetch" href="static.zhihu.com" /> 
  <link rel="dns-prefetch" href="upload.zhihu.com" /> 
  <link rel="stylesheet" href="/zhihu/home/Css/main.d5b9fe28.css" /> 
  <meta name="google-site-verification" content="FTeR0c8arOPKh8c5DYh_9uu98_zJbaWw53J-Sch9MTg" /> 
  <meta name="baidu-site-verification" content="KPFppAFoYF4Kkdv9" /> 
  <meta property="qc:admins" content="00544670776201056375" /> 
  <link rel="canonical" href="http://www.zhihu.com" /> 
  <meta id="znonce" name="znonce" content="007b6d6e8f3d4eb7a59034ac00018de1" /> 
  <!--[if lt IE 9]>
<script src="/zhihu/home/Scripts/respond.min.js"></script>
<link href="http://static.zhihu.com/static/components/respond/cross-domain/respond-proxy.html" id="respond-proxy" rel="respond-proxy" />
<link href="/static/components/respond/cross-domain/respond.proxy.gif" id="respond-redirect" rel="respond-redirect" />
<script src="/zhihu/home/Scripts/respond.proxy.js"></script>
<![endif]--> 
  <script src="/zhihu/home/Scripts/instant.14757a4a.js"></script> 
 </head> 
 <body class="zhi "> 
  <div class="index-main"> 
   <div class="index-main-body"> 
    <div class="index-header"> 
     <h1 class="logo hide-text">知乎</h1> 
     <img src="/zhihu/home/bb.png" style="position:absolute;top:55px;right:640px;" alt="">
     <h2 class="subtitle">与世界分享你的知识、经验和见解</h2> 
    </div> 
    <div class="desk-front sign-flow clearfix sign-flow-simple"> 
     <div class="index-tab-navs"> 
      <div class="navs-slider"> 
       <a href="{{url('/register')}}" class="active">注册</a> 
       <a href="{{url('/login')}}">登录</a> 
      </div> 
     </div>  
     <div class="view view-signup selected" data-za-module="SignUpForm"> 
      <form  action="{{url('/register')}}"   method="post"> 
       <input type="password" hidden="" /> 
       <input type="hidden" name="_xsrf" value="ab707bf124935e4d703b3efabcfc00d2" /> 
       <div class="group-inputs"> 
        <div class="name input-wrapper"> 
         <input required="" type="text" name="username" readmin="请输入6-18位数字字母下划线" aria-label="姓名" placeholder="姓名" />
         <div style="position:absolute;top:20px;left:230px;"></div>
        </div> 
        <div class="name input-wrapper"> 
         <input required="" type="text" name="email" aria-label="邮箱" placeholder="邮箱" /> 
        </div> 
        <div class="input-wrapper"> 
         <input required="" type="password" name="password" aria-label="密码" placeholder="密码（不少于 6 位）" autocomplete="off" /> 
        </div> 
        <div class="email input-wrapper"> 
         <input required="" type="text" class="account" id="check" name="phone" aria-label="手机号（仅支持中国大陆）" placeholder="手机号（仅支持中国大陆）" /> 
        </div>
        <div class="name input-wrapper"> 
        <button id="sendPhone" type="button" class="sign-button" style="width:100px;height:47px;float:right">发送验证码</button>
         <input  type="text" name="code" aria-label="验证码" style="width:197px" placeholder="验证码" />
        </div> 
       </div> 
       <div class="button-wrapper command"> 
        <button class="sign-button submit"  type="submit">注册知乎</button> 
       </div>
       
        @if(session('error'))
            <div style="font-size:20px;color:red">
                   {{session('error')}}
            </div>
        @endif
         @if(session('success'))
            <div style="font-size:20px;color:red">
                   {{session('success')}}
            </div>
        @endif
        @if (count($errors) > 0)
        <div class="alert alert-danger">
            <ul>
                @foreach($errors->all() as $error)
                    <li>{{ $error }}</li>
                @endforeach
            </ul>
        </div>
        @endif
       {{csrf_field()}} 
      </form> 
      
      <p class="agreement-tip">点击「注册」按钮，即代表你同意<a href="/terms" target="_blank">《知乎协议》</a></p> 
      <div class="QRCode"> 
       <button class="QRCode-toggleButton"> <span class="sprite-global-icon-qrcode"></span> <span class="QRCode-toggleButtonText ">下载知乎 App</span> </button> 
       <div class="QRCode-card"> 
        <div class="QRCode-image"></div> 
        <div class="sprite-index-icon-arrow"></div> 
       </div> 
      </div> 
     </div> 
    </div> 
   </div> 
  </div> 
  <div class="footer"> 
   <span>&copy; 2016 知乎</span> 
   <span class="dot">&middot;</span> 
   <a target="_blank" href="/roundtable">知乎圆桌</a> 
   <span class="dot">&middot;</span> 
   <a target="_blank" href="/explore" data-za-c="explore" data-za-a="visit_explore" data-za-l="home_bottom_explore">发现</a> 
   <span class="dot">&middot;</span> 
   <a target="_blank" href="/app">移动应用</a> 
   <span class="dot">&middot;</span> 
   <a href="/org/signin" class="footer-mobile-show">使用机构帐号登录</a> 
   <span class="dot footer-mobile-show">&middot;</span> 
   <a href="/contact" class="footer-mobile-show">联系我们</a> 
   <span class="dot">&middot;</span> 
   <a target="_blank" href="/careers">来知乎工作</a> 
   <span class="dot">&middot;</span> 
   <a href="http://www.miibeian.gov.cn/" target="_blank">京 ICP 备 13052560 号</a> 
   <span class="dot">&middot;</span> 
   <span>京公网安备 11010802010035 号</span> 
  </div> 
  <script type="text/json" class="json-inline" data-name="disabled_components">["back_to_top"]</script> 
  <script type="text/json" class="json-inline" data-name="current_user">["","","","-1","",0,0]</script> 
  <script type="text/json" class="json-inline" data-name="env">["zhihu.com","comet.zhihu.com",false,null,false,false]</script> 
  <script type="text/json" class="json-inline" data-name="ga_vars">{"user_created":0,"now":1477827609000,"abtest_mask":"------------------------------","user_attr":[0,0,0,"-","-"],"user_hash":0}</script> 
  <script src="/zhihu/home/Scripts/vendor.cb14a042.js"></script> 
  <script src="/zhihu/home/Scripts/base.c5da0417.js"></script> 
  <script src="/zhihu/home/Scripts/common.6696df0c.js"></script> 
  <script src="/zhihu/home/Scripts/page-index.c0050212.js"></script> 
  <meta name="entry" content="ZH.entrySignPage" data-module-id="page-index" /> 
  <input type="hidden" name="_xsrf" value="ab707bf124935e4d703b3efabcfc00d2" />  
 </body>
</html>
<script type="text/javascript" src="/zhihu/home/jquery-1.8.3.min.js"></script>
<script type="text/javascript">
  // alert($);

  //获取按钮
  $('#sendPhone').click(function(){
    //获取当前手机号
    var v = $('input[name=phone]').val();
    
    // alert(v);
    //验证手机号是否正确
    var reg = /^1\d{10}$/;
    
    if(reg.test(v)){
      // alert('手机号格式正确');
      $.get('/send',{phone:v},function(data){
        if(data == 1){
          alert('验证码发送成功');
        }
      });
    }
  })

  

  //全局变量
  var CUSER = false;
  var CPASS = false;
  var CEMAIL = false;
  var CPHONE = false;

  //绑定表单提交事件
  $('form').submit(function(){
    //触发所有的丧失焦点事件
    $('input').trigger('blur');
    //验证所有字段都正确 提交
    if(CPHONE && CEMAIL){
      //提交
      return true;
    }
    //阻止默认行为
    return false;
  })

  //绑定丧失焦点事件
  $('#check').blur(function(){
    //获取手机号
    var p = $('input[name=phone]').val();
    // alert(p);

    $.get('/phonecheck',{phone:p},function(data){
      if(data == 1){
        CPHONE = true;
      }else{
        CPHONE = false;
        alert('此用户已注册');
      }
    });
  })

  //验证邮箱
  $('input[name=email]').blur(function(){
    //获取邮箱号
    var email = $(this).val();
    // alert(email);
    //声明正则
    var reg = /^\w+@\w+\.(com|cn|com\.cn|net|org)$/;
    if(reg.test(email)){
        //正确
        CEMAIL = true;
    }else{
      setTimeout(alert('邮箱格式不正确'),100);

      CEMAIL = false;

    }
  })   
</script>

